var pubUrl = "https://mdz.sdphjr.com:8080"//这是我要请求的数据接口的公共部分
// var pubUrl = "http://192.168.0.118:8080"//这是我要请求的数据接口的公共部分
function POST(url, params) {
  //加载loading 
  wx.showLoading({
      title: '加载中...',
      mask: true
  })
  let promise = new Promise(function (resolve, reject) {
    console.log("request:get:"+pubUrl+url)
      wx.request({
          url: pubUrl+url,
          data: params,
          header: {
              "Content-Type": "application/x-www-form-urlencoded",
          },
          method: 'POST',
          success: (res) => {
              resolve(res)
          },
          fail: (res) => {
              reject(res)
          },
          complete: () => {
              wx.hideLoading()
          }
      })
  });
  return promise;
}
function GET(url, params) {
  console.log("request:get:"+pubUrl+url)
  let promise = new Promise(function (resolve, reject) {
      wx.request({
          url: pubUrl+url,
          data: params,
          header: {
              "Content-Type": "application/x-www-form-urlencoded",
          },
          method: 'GET',
          success: (res) => {
              resolve(res)
          },
          fail: (res) => {
              reject(res)
          }
      })
  });
  return promise
}
module.exports = {
  POST: POST,
  GET: GET,
}